const axios = require('axios')
let _baseUrl = '/orderservice'

// 获取算力配置扣费规则
export function getCalculationPowerConfList (query) {
  const url = _baseUrl + '/calculationPower/getCalculationPowerConfList' + query
  return axios.get(url).then((res) => {
    return Promise.resolve(res.data)
  })
}

// 查询用户剩余算力和已用算力数量接口
export function getUserCalculationPower (query) {
  const url = _baseUrl + '/calculationPower/getUserCalculationPower' + query
  return axios.get(url).then((res) => {
    return Promise.resolve(res.data)
  })
}

// 查询已使用的存储
export function queryStorage (query) {
  const url = _baseUrl + '/orderStorage/queryStorage' + query
  return axios.get(url).then((res) => {
    return Promise.resolve(res.data)
  })
}

// 查询用户的总存储空间
export function getOrderStorageCountByUserId (data) {
  const url = _baseUrl + '/orderStorage/getOrderStorageCountByUserId'
  return axios.post(url, data).then((res) => {
    return Promise.resolve(res.data)
  })
}

// 查询用户算力明细列表
export function getUserCalculationPowerDetails (query) {
  const url = _baseUrl + '/calculationPower/getUserCalculationPowerDetails' + query
  return axios.get(url).then((res) => {
    return Promise.resolve(res.data)
  })
}

// 查询用户算力-明细信息
export function getTasks (query) {
  const url = _baseUrl + '/calculationPower/getTasks' + query
  return axios.get(url).then((res) => {
    return Promise.resolve(res.data)
  })
}

// 获取算力商品集合
export function getCalculate (data) {
  const url = _baseUrl + '/aiproduct/getCalculate'
  return axios.post(url, data).then((res) => {
    return Promise.resolve(res.data)
  })
}

// 算力下订单
export function saveOrderToPay (data) {
  const url = _baseUrl + '/order/saveOrderToPay'
  return axios.post(url, data).then((res) => {
    return Promise.resolve(res.data)
  })
}

// 微信支付-二维码
export function toWeChatPay (id) {
  const url = _baseUrl + '/pay/toWeChatPay?order_id=' + id
  return url
}

// 跳转支付宝支付路径
export function toAlipay (id) {
  const url = _baseUrl + '/pay/toAlipay?order_id=' + id + '&platform=jspt'
  return url
}

// 瑶瑶支付路径
export function cebBankPay (data) {
  const url = _baseUrl + '/order/cebBankPay'
  return axios.post(url, data).then((res) => {
    return Promise.resolve(res.data)
  })
}

// 获取订单支付状态
export function getOrderPayStatus (data) {
  const url = _baseUrl + '/order/getOrderPayStatus'
  return axios.post(url, data).then((res) => {
    return Promise.resolve(res.data)
  })
}

// 查询任务消耗算力情况
export function getTaskExpend (data) {
  const url = _baseUrl + '/calculationPower/getTaskExpend'
  return axios.post(url, data).then((res) => {
    return Promise.resolve(res.data)
  })
}

// 校验算力券
export function validationCoupons (data) {
  const url = _baseUrl + '/order/validationCoupons'
  return axios.post(url, data).then((res) => {
    return Promise.resolve(res.data)
  })
}

// 添加团队任务关系
export function addTeamTaskRelation (data) {
  const url = _baseUrl + '/calculationPower/addTeamTaskRelation'
  return axios.post(url, data).then((res) => {
    return Promise.resolve(res.data)
  })
}
